Skip to content

fix(api): provision defaults for invited teams - #2922

Draft
mfroembgen wants to merge 1 commit into
hyperdxio:mainfrom
mfroembgen:codex/2921-invite-defaults
Draft

fix(api): provision defaults for invited teams#2922
mfroembgen wants to merge 1 commit into
hyperdxio:mainfrom
mfroembgen:codex/2921-invite-defaults

Conversation

@mfroembgen

Copy link
Copy Markdown
Contributor

Summary

  • apply configured default connections and sources when a user accepts a team invite
  • keep default provisioning non-blocking, matching password registration

How to test on Vercel preview

N/A — non-UI change

Testing

  • make dev-int FILE=team
  • make ci-lint
  • make ci-unit

References

@changeset-bot

changeset-bot Bot commented Aug 17, 2026

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: 4ec0a23

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 3 packages
Name Type
@hyperdx/api Patch
@hyperdx/app Patch
@hyperdx/otel-collector Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@vercel

vercel Bot commented Aug 17, 2026

Copy link
Copy Markdown

@mfroembgen is attempting to deploy a commit to the HyperDX Team on Vercel.

A member of the Team first needs to authorize it.

@greptile-apps

greptile-apps Bot commented Aug 17, 2026

Copy link
Copy Markdown
Contributor

Greptile Summary

This PR provisions configured default connections and sources when an invited user creates their account, while allowing invite acceptance to continue after provisioning errors.

  • Adds default provisioning to the invite-acceptance route.
  • Adds an integration test asserting that provisioning receives the invited team ID.
  • Adds a patch changeset for the API package.

Confidence Score: 4/5

This PR should not merge until invited-team provisioning is guaranteed to resolve and write resources for the invitation's actual team.

The new invite path reaches a helper whose team lookup discards the supplied ID, allowing configured defaults to be assigned to another tenant; the added test mocks that helper and therefore does not detect the failure.

Files Needing Attention: packages/api/src/routers/api/root.ts, packages/api/src/setupDefaults.ts, packages/api/src/controllers/team.ts

Important Files Changed

Filename Overview
packages/api/src/routers/api/root.ts Adds invited-team default provisioning, but the newly exposed lookup path can provision resources under the wrong team and lacks required instrumentation.
packages/api/src/routers/api/tests/team.int.test.ts Verifies the setup helper receives the invited team ID, but mocking the helper does not exercise its incorrect internal team lookup.
.changeset/tidy-invites-share.md Correctly records the API behavior change as a patch release.

Fix all with Greploop

Fix All in Claude Code Fix All in Conductor Fix All in Cursor Fix All in Codex

Reviews (1): Last reviewed commit: "fix(api): provision defaults for invited..." | Re-trigger Greptile

}

try {
await setupTeamDefaults(teamInvite.teamId.toString());

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 Provisioning resolves the wrong team

If the invited team is not the first team returned by MongoDB, this call reaches getTeam(teamId), which ignores the supplied ID, causing default connections and sources to be assigned to another tenant while the invited team remains unprovisioned.

Knowledge Base Used:

Fix in Claude Code Fix in Conductor Fix in Cursor Fix in Codex

Comment on lines +171 to +177
try {
await setupTeamDefaults(teamInvite.teamId.toString());
} catch (error) {
logger.error(
{ err: serializeError(error) },
'Failed to setup team defaults',
);

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Provisioning lacks operational context

The added team-scoped provisioning call and its countable failure log attach neither business context nor a metric, preventing failures from being reliably attributed and counted by team during incident diagnosis.

Context Used: AGENTS.md (source)

Note: If this suggestion doesn't match your team's coding style, reply to this and let me know. I'll remember it for next time!

Fix in Claude Code Fix in Conductor Fix in Cursor Fix in Codex

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Apply default connections and sources when accepting a team invite

1 participant